insert a node at the head of a linked list hackerrank solution